#pragma once

#include "idspace.h"

#define COMMON_ERROR					0
#define SYSTEM_ERROR						100
#define IO_ERROR								200
#define MEMORY_ERROR						300
#define VERSION_ERROR						400

/*!common error*/
DEFINE_ERROR(vok,											idspace_special,		COMMON_ERROR+0)
DEFINE_ERROR(vfailed,									idspace_special,		COMMON_ERROR+1)
DEFINE_ERROR(err_notsupport,						idspace_special,		COMMON_ERROR+2);
DEFINE_ERROR(err_notimplement,				idspace_special,		COMMON_ERROR+3);
DEFINE_ERROR(err_cancel,								idspace_special,		COMMON_ERROR+4);
DEFINE_ERROR(err_unknown,						idspace_special,		COMMON_ERROR+5);
DEFINE_ERROR(err_unmatched,						idspace_special,		COMMON_ERROR+6);
DEFINE_ERROR(err_invalid,							idspace_special,		COMMON_ERROR+7);

/*!system error*/
DEFINE_ERROR(err_reflocked,						idspace_special,		SYSTEM_ERROR+1);
DEFINE_ERROR(err_objectdisposed,				idspace_special,		SYSTEM_ERROR+2);
DEFINE_ERROR(err_notregistered,				idspace_special,		SYSTEM_ERROR+3);
DEFINE_ERROR(err_unloadfailed,					idspace_special,		SYSTEM_ERROR+4);
DEFINE_ERROR(err_nomodule,						idspace_special,		SYSTEM_ERROR+5);
DEFINE_ERROR(err_notvmodule,					idspace_special,		SYSTEM_ERROR+6);
DEFINE_ERROR(err_objectfindfailed,			idspace_special,		SYSTEM_ERROR+7);
DEFINE_ERROR(err_nullobject,						idspace_special,		SYSTEM_ERROR+8);
DEFINE_ERROR(err_invalidobjectnode,		idspace_special,		SYSTEM_ERROR+9);

DEFINE_ERROR(err_allocfailed,						idspace_special,		MEMORY_ERROR+1);
DEFINE_ERROR(err_outofmemory,					idspace_special,		MEMORY_ERROR+2);
DEFINE_ERROR(err_memoryfreefailed,			idspace_special,		MEMORY_ERROR+3);
DEFINE_ERROR(err_nullpointer,						idspace_special,		MEMORY_ERROR+4);

/*!io error*/
DEFINE_ERROR(err_flushfailed,						idspace_special,		IO_ERROR+1);
DEFINE_ERROR(err_savefailed,						idspace_special,		IO_ERROR+2);
DEFINE_ERROR(err_openfailed,						idspace_special,		IO_ERROR+3);
DEFINE_ERROR(err_fileopened,						idspace_special,		IO_ERROR+4);
DEFINE_ERROR(err_filereadfailed,					idspace_special,		IO_ERROR+5);
DEFINE_ERROR(err_diskfull,							idspace_special,		IO_ERROR+6);
DEFINE_ERROR(err_section,							idspace_special,		IO_ERROR+7);

/*!version error*/
DEFINE_ERROR(err_zeroversion,					idspace_special,		VERSION_ERROR+1);
DEFINE_ERROR(err_higherversion,				idspace_special,		VERSION_ERROR+2);
DEFINE_ERROR(err_versionerror,					idspace_special,		VERSION_ERROR+3);